﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFramework.Entity;

public class HumanEntity : Entity
{
    public float rotateSpeed;

    private Animator m_Animator;
    private int speedXID;
    private int speedZID;
    private int spaceID;

    // Start is called before the first frame update
    void Start()
    {
        m_Animator = GetComponent<Animator>();

        speedXID = Animator.StringToHash("SpeedX");
        speedZID = Animator.StringToHash("SpeedZ");
        spaceID = Animator.StringToHash("Jump");
    }

    // Update is called once per frame
    void Update()
    {
        m_Animator.SetFloat(speedXID, Input.GetAxis("Horizontal"));
        m_Animator.SetFloat(speedZID, Input.GetAxis("Vertical"));

        if (Input.GetKeyDown(KeyCode.Space) && !m_Animator.GetCurrentAnimatorStateInfo(0).IsName("Jump"))
        {
            m_Animator.SetTrigger("Jump");
        }
    }
}